<?php
/*
 * @Author: your name
 * @Date: 2020-10-28 23:20:33
 * @LastEditTime: 2020-12-25 17:10:50
 * @LastEditors: Please set LastEditors
 * @Description: 防火墙模块路由
 * @FilePath: /special/route/module/netfilter.php
 */
 
 Route::group('netfilter',  function () use ($route) {
     $route = $route . '.' . 'netfilter';
    //主机管理
    Route::group('host',  function () use ($route) {
        $route = $route . '.' . 'NetfilterHost';
        //主机列表
        Route::rule('list', $route . '/' . 'list');
        Route::rule('studyrelation', $route . '/' . 'studyRelation');
    });
    //模块关系管理
    Route::group('relation',  function () use ($route) {
        $route = $route . '.' . 'NetfilterModuleRelation';
        //未添加netfilter模块主机列表
        Route::rule('list', $route . '/' . 'list');
        //主机添加模块
        Route::rule('add', $route . '/' . 'add');
        //主机删除模块
        Route::rule('delete', $route . '/' .  'del');
    });
    //防火墙设置
    Route::group('firewall/set',  function () use ($route) {
        $route = $route . '.' . 'FirewallSet';
        //linux防火墙配置修改
        Route::rule('linux/firewall/config/modify', $route . '/' . 'linuxFirewallConfigModify');
        //windows防火墙配置修改
        Route::rule('windows/firewall/config/modify', $route . '/' . 'windowsFirewallConfigModify');
        //学习初始化
        //Route::rule('host/netfilter/initialization', $route . '/' . 'initialization');
        //接管防火墙
        Route::rule('control/firewall', $route . '/' . 'controlledFirewall');
        //取消接管防火墙
        Route::rule('uncontrol/firewall', $route . '/' . 'uncontrolledFirewall');
    });
    //防火墙规则
    Route::group('firewall/rule',  function () use ($route) {
        $route = $route . '.' . 'FirewallRule';
        //规则列表
        Route::rule('list', $route . '/' . 'firewallRuleList');
        //防火墙手动规则添加
        Route::rule('add', $route . '/' . 'firewallRuleAdd');
        //防火墙规则修改
        Route::rule('modify', $route . '/' . 'firewallRuleModify');
        //防火墙规则删除
        Route::rule('delete', $route . '/' . 'firewallRuleDelete');
        //防火墙规则开启
        Route::rule('on', $route . '/' . 'firewallRuleOn');
        //防火墙规则关闭
        Route::rule('off', $route . '/' . 'firewallRuleOff');
    });
    //防火墙虚拟规则
    Route::group('firewall/virtual/rule',  function () use ($route) {
        $route = $route . '.' . 'FirewallVirtualRule';
        //虚拟规则列表
        Route::rule('list', $route . '/' . 'virtualList');
        //虚拟规则添加
        Route::rule('add', $route . '/' . 'virtualAdd');
        //虚拟规则修改
        Route::rule('modify', $route . '/' . 'virtualModify');
        //虚拟规则删除
        Route::rule('delete', $route . '/' . 'virtualDelete');
        //虚拟规则开启
        Route::rule('on', $route . '/' . 'virtualOn');
        //虚拟规则关闭
        Route::rule('off', $route . '/' . 'virtualOff');
        //虚拟规则命中日志列表
        Route::rule('hit/list', $route . '/' . 'virtualRuleHitLogList');
    });
    //防火墙原始规则
    Route::group('firewall/origin/rule',  function ()  use ($route) {
        $route = $route . '.' . 'FirewallOriginRule';
        //原始规则列表
        Route::rule('list', $route . '/' . 'originRuleList');
        //删除原始规则
        Route::rule('delete', $route . '/' . 'originRuleDelete');
        //启用规则
        Route::rule('on', $route . '/' . 'on');
        //禁用规则
        Route::rule('off', $route . '/' . 'off');
    });
    //默认规则(维持客户端正常运作的)
    Route::group('firewall/safe/rule',  function () use ($route) {
        $route = $route . '.' . 'FirewallSafeRule';
        //默认规则列表
        Route::rule('list', $route . '/' . 'safeRuleList');
        //启用规则
        Route::rule('on', $route . '/' . 'safeRuleOn');
        //禁用规则
        Route::rule('off', $route . '/' . 'safeRuleOff');
    });
    
    //访问日志
    Route::group('access_log',  function () use ($route) {
        $route = $route . '.' . 'AccessLog';
        //日志ip组列表
        Route::rule('host/:host_id/log/list/:ignore', $route . '/' . 'list');
        //日志ip组详细数据列表
        Route::rule('host/:host_id/log/detail/:ignore', $route .  '/' . 'detail');
        //开启日志记录
        Route::rule('host/:host_id/log/open', $route . '/' . 'open');
        //关闭日志记录
        Route::rule('host/:host_id/log/close', $route . '/' . 'close');
        //读取日志配置
        Route::rule('host/:host_id/log/config/read', $route . '/' . 'readConfig');
        //修改日志配置
        Route::rule('host/log/config/modify', $route . '/' . 'modifyConfig');
        //忽略日志
        Route::rule('host/:host_id/log/ignore', $route . '/' . 'ignoreLog');
        //恢复日志
        Route::rule('host/:host_id/log/recovery', $route . '/' . 'unignoreLog');
        //警告列表
        Route::rule('host/:host_id/warring/list', $route . '/' . 'warringList');//告警日志
    });

    //访问日志学习
    Route::group('access_log/learn',  function () use ($route) {
        $route = $route . '.' . 'AccessLogLearn';
        //学习数据列表 路由参数的:mark 变为post-body参数获取
        Route::rule('list', $route . '/' . 'learnDataList');
        //学习数据组列表
        Route::rule('group/list', $route . '/' . 'LearnDataStatisticsList');
        //生成防火墙规则
        Route::rule('createRule', $route . '/' . 'createFirewallRule');
        //删除学习数据
        Route::rule('delete', $route . '/' . 'learnDataDelete');
        //开启单个主机学习
        Route::rule('one_on', $route . '/' . 'oneLearnOn');
        //批量开启学习
        Route::rule('bulk_on', $route . '/' . 'bulkLearnOn');
        //关闭学习
        Route::rule('off', $route . '/' . 'learnOff');
        //学习配置详情
        Route::rule('info', $route . '/' . 'configInfo');
        //学习配置修改
        Route::rule('modify', $route . '/' . 'configModify');
        //学习数据生成规则
        Route::rule('create_firewall_rule', $route . '/' . 'createFirewallRule');
    });

    //规则预览
    Route::group('rule/preview',  function () use ($route) {
        $route = $route . '.' . 'RulePreview/';
        //列表
        Route::rule('list', $route . 'list');
        //排序
        Route::rule('sort', $route . 'sort');
        //推送规则到客户端
        Route::rule('push_to_client', $route . 'pushToClient');
    });

    //规则应用日志
    Route::group('rule_log',  function () use ($route) {
        $route = $route . '.' . 'RuleLog/';
        //列表
        Route::rule('list', $route . 'list');
        //规则集合详情
        Route::rule('info', $route . 'info');
        //删除
        Route::rule('delete', $route . 'delete');
        //规则回滚
        Route::rule('reset', $route . 'reset');
    });
});